/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sdd.facades.business;

import com.sdd.entities.FeatureCategory;
import com.sdd.facades.persistence.FeatureCategoryPersistenceFacade;
import com.sdd.plains.FeatureCategoryPlain;
import javax.ejb.EJB;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;

/**
 *
 * @author T
 */
@Stateless
@LocalBean
public class FeatureCategoryBusinessFacadeBean {
    @EJB
    FeatureCategoryPersistenceFacade featureCategoryPersistenceFacade;
    
        
    public FeatureCategory getFeatureCategory(Long id){
        return featureCategoryPersistenceFacade.find(id);
    }    
    
    public FeatureCategory getFeatureCategory(String name){
        System.out.println("YYYYYYYYYYYYYYYYYYYYY");
        return featureCategoryPersistenceFacade.findByName(name);
    }
    
    public FeatureCategory addFeature(FeatureCategoryPlain plain){
        FeatureCategory fc = new FeatureCategory();
        fc.setId(plain.getId());
        fc.setName(plain.getName());
        fc.setDescription(plain.getDescription());
        return featureCategoryPersistenceFacade.create(fc);
    }
    
}

